<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //实现迭代器的集合([Symbol.iterator]属性)可以用for of遍历
        let arr = ['a', 'b', 'c']
        console.log(arr)
        for (let v of arr) {
            console.log(v)
        }
        //等价于获取迭代器对象，调用迭代器的next()
        let it = arr[Symbol.iterator]()
        let finish;
        while(true) {
            item = it.next()
            finish = item.done
            if(!finish) {
                console.log(item.value)
            }else{
                break
            }
        }
    </script>
</body>
</html>